home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
minix
/
up1510b.tgz
/
up1510b
/
src
/
commands
/
kill.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-07-23
|
601b
|
38 lines
/* kill - send a signal to a process Author: Adri Koppes */
#include <sys/types.h>
#include <signal.h>
extern char *itoa();
main(argc, argv)
int argc;
char **argv;
{
int proc, signal = SIGTERM;
if (argc < 2) usage();
if (argc > 1 && *argv[1] == '-') {
signal = atoi(&argv[1][1]);
if (!signal) usage();
argv++;
argc--;
}
while (--argc) {
argv++;
proc = atoi(*argv);
if (!proc && strcmp(*argv, "0")) usage();
if (kill(proc, signal)) {
prints("Kill: %s no such process\n", itoa(proc));
exit(1);
}
}
exit(0);
}
usage()
{
prints("Usage: kill [-sig] pid\n");
exit(1);
}